# -*- coding: utf-8 -*-
# !/usr/bin/env python
from rest_framework.views import APIView

from components.kubernetes.dao import set_k8s_api_sign
from utils.views import Result, ReturnClass


class K8sApisignManage(APIView):
    def post(self, request):
        data = request.data
        re_data = set_k8s_api_sign(data['host_id'], data['kubernetes_cluster_id'])

        if ReturnClass.if_ok(re_data):
            return Result.success_response(msg='标记成功')
        else:
            return Result.fail_response(ReturnClass.get_value(re_data))